package com.roadjava.log.jul.demo3;

import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;

public class JulService3 {

    static LogManager logManager = LogManager.getLogManager();

    static {
        InputStream rs = JulService3.class.getClassLoader().getResourceAsStream("logging.properties");
        try {
            logManager.readConfiguration(rs);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) {
//        Logger logger = Logger.getLogger("com.roadjava.log.jul.abc");
        Logger logger = Logger.getLogger(JulService3.class.getName());

        logger.log(Level.FINEST, "finest level"); // FINEST：最好的
        logger.log(Level.FINER, "finer level"); // FINER：更好的
        logger.log(Level.FINE, "fine level"); // FINE：好的
        logger.log(Level.CONFIG, "config level"); // CONFIG：配置

        logger.log(Level.INFO, "info level");

        logger.log(Level.WARNING, "warning level1"); // WARNING：警告
        logger.warning("warning level2");

        logger.log(Level.SEVERE, "severe level"); // SEVERE：严重
    }

}
